package YAPserver.mods;

import YAPenvironment.YAPconstant.ModState;
import YAPserver.gameObjects.Mod;
import YAPserver.logic.GameModifier;
import YAPserver.logic.Player;
/**
 * A global ModBehaviour.
 * When this modBehaviour's modify method is called all gameBalls radiuses become 20.
 * The demodify method sets the default radius back to 5 so that all new gameBalls have this radius. The demodify
 * method is called when the mod's timer has hit 0.
 * @author Daniel
 *
 */
public class ModHugeBall extends AbstractStandardMod{
	private final static String C_name = "Huge-Ball";
	@Override
	public void modify(Mod mod, GameModifier gameMod, Player player) {
		super.modify(mod, gameMod, player);
		gameMod.setAllBallRadius(20);
		gameMod.setBallDefaultRadius(20);
		gameMod.addModActive(mod);
		
		gameMod.checkBallCollisions();
		gameMod.checkDoubleCollisions();
		
		mod.setTimerOn(true);
		gameMod.addActivation(C_name);
	}

	@Override
	public void deModify(Mod mod, GameModifier gameMod, Player player) {
		gameMod.subtractActivation(C_name);
		gameMod.removeModActive(mod);
		if(gameMod.getActivations(C_name) <= 0){
			gameMod.setBallDefaultRadius(5);
			gameMod.removeActivation(C_name);
		}
	}

	@Override
	public ModState getType() {
		return ModState.global;
	}

}
